package cn.hsa.fqz.task.service.impl;

import cn.hsa.fqz.common.utils.CHExecutor;
import cn.hsa.fqz.common.utils.page.PageData;
import cn.hsa.fqz.task.service.IDataFluxService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author 刘隽
 * @version v1.0
 * @apiNote 功能描述:()
 * @date create in 2022/10/17 17:41
 */
@Slf4j
@Service
public class DataFluxServiceImpl implements IDataFluxService {

    @Override
    public PageData<Map<String, Object>> getTaskSqlExecutePageResult(String host,Integer port,String passwd,String sql, int pageNum, int pageSize) {
        return  CHExecutor.getMapPage(host,port,passwd,sql,pageNum,pageSize);
    }

    @Override
    public List<Map<String, Object>> getTaskSqlExecuteList(String host,Integer port,String passwd,String sql) {
        return CHExecutor.getMapList(host,port,passwd,sql);
    }



    @Override
    public Long executeSql(String host, Integer port,String passwd, String sql) {
        return CHExecutor.executeSql(host,port,passwd,sql);
    }

    @Override
    public List<String> getColumns(String host, Integer port, String passwd, String sql) {
        return CHExecutor.getColumnsBySql(host, port, passwd, sql);
    }
}
